Skip to content

Rewrite decode.py to always pick a valid codec#19

Open
StanFromIreland wants to merge 2 commits intopython:mainfrom
StanFromIreland:decode
Open

Rewrite decode.py to always pick a valid codec#19
StanFromIreland wants to merge 2 commits intopython:mainfrom
StanFromIreland:decode

Conversation

@StanFromIreland
Copy link
Copy Markdown
Member

I don't quite get the original idea behind the fuzzer, as I assume currently it is failing with a LookupError on an invalid codec most of the time, never reaching any actual decoding. Instead, I suggest we drop the dictionary and pick a known codec. The codec rejection path is quite simple, I don't really think it is worth spending time fuzzing it.

@StanFromIreland StanFromIreland requested a review from a team March 26, 2026 20:27
Copy link
Copy Markdown
Collaborator

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're using FuzzerInput[0] directly as an integer this means potentially we'd start missing codecs if there are more than 256 of them. How many codecs are there today, are we at risk of getting close to that number? If so: maybe we take two bytes for the index, add an assert in there than len(ALL_CODECS) < 0xFFFF and call that good?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants